package com.smh.hmdianping.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author shiminghui
 * @date 2025/3/29 16:42
 * @description: TODO
 */
@Configuration
public class RedissonConfig {

    @Bean
    public RedissonClient redissonClient() {
        Config config = new Config();
        // 单机模式
        config.useSingleServer().setAddress("redis://39.105.11.64:6379").setPassword("123456").setDatabase(0);
        // 集群模式
//        config.useClusterServers().addNodeAddress("127.0.0.1:7001", "127.0.0.1:7002", "127.0.0.1:7003", "127.0.0.1:7004")
        return Redisson.create(config);
    }

}
